#include<stdio.h>
#include<malloc.h>

typedef struct LNode
{
    char name[20];
    int height;
    int weight;
    struct LNode *next;
}LNode,*Linklist;

Linklist Insert(Linklist head)
{
    int n,temp,flag=0;
    Linklist p,q;
    q=head;
    if(head!=NULL)
    {
        while((q->next)!=NULL)  q=(Linklist)q->next;
        flag=1;
    }
    scanf("%d",&n);
    for(int i=0;i<n;i++)
    {
        p=(Linklist)malloc(sizeof(LNode));
        p->next=NULL;
        scanf("%s %d %d",p->name,&(p->weight),&(p->height));
        if(flag==1)  q->next=(struct LNode*)p;
        else head=p;
        q=p;
        flag=1;
    }
    return(head);
}

Linklist Delete(Linklist head)
{
    int i;
    scanf("%d",&i);
    Linklist p,q;
    if(i==1)
    {
        p=(Linklist)head->next;
        head=p;
        return (head);
    }
    p=head;
    int count=1;
    while(p&&count<i-1)
    {
        p=(Linklist)p->next;
        ++count;
    }
    if(!p||count>i)
    {
        //printf("删除失败\n");
        return (head);
    }
    q=(Linklist)p->next;
    p->next=q->next;
    free(q);
    //printf("删除成功\n");
    return(head);
}

void DispList(Linklist head)
{
    Linklist q;
    q=head;
    //printf("当前单链表数据输出：");
    while(q!=NULL)
    {
        printf("%s %d %d\n",q->name,q->weight,q->height);
        q=(Linklist)q->next;
    }
}

int main()
{
    Linklist head;
    head=NULL;
    head=Insert(head);
    head=Delete(head);
    DispList(head);
}
    